import {GET_BASIC_TABLE} from './action_type';
import {requestBasicTableData} from '../../../services/table_services';

const setBasicTableData = (data)=>{
  // 设置基础表格的值
  return {
    type: GET_BASIC_TABLE,
    basicTableData: data
  }
}
export const getBasicTableData = () => {
  // 先获取表格数据，再发送数据
  return async dispatch => {
    const data = await requestBasicTableData();
    data.result.forEach(item => {
      item.key=item.id;
    });
    dispatch(setBasicTableData(data));
  }
}
